import React,{useState,useEffect} from 'react'
import { useParams } from 'react-router-dom'
import { useRequest } from './Hooks';

const Detail = () => {
    const {id} = useParams();
    const [topic] = useRequest('https://cnodejs.org/api/v1/topic/'+id);
    return (
        <div>
            <div>
                {/* 登录名：{topic.author&&topic.author.loginname} */}
                登录名：{topic.author?.loginname}
                <img src={topic.author?.avatar_url} alt="" />
            </div>
            <div dangerouslySetInnerHTML={{__html:topic.content}}></div>
        </div>
    )
}

export default Detail
